// import Login from './pages/Login'
// import Layout from './pages/Layout'
// import NotFound from './pages/NotFound'
import React, { Suspense } from 'react'
import history from './utils/history'
import PrivateRoute from '@/components/PrivateRoute'
import { Router, Route, Switch, Redirect } from 'react-router-dom'
const Login = React.lazy(() => import('./pages/Login'))
const Layout = React.lazy(() => import('./pages/Layout'))
const NotFound = React.lazy(() => import('./pages/NotFound'))
function App() {
  return (
    <Router history={history}>
      <div className="login-container">
        <Suspense fallback={<div>Loading...</div>}>
          <Switch>
            <Redirect exact from="/" to="/home" />
            <Route path="/login" component={Login}></Route>
            {/* <Route path="/home" component={Layout}></Route> */}
            <PrivateRoute path="/home" component={Layout}></PrivateRoute>
            {/* <PrivateRoute path="/home">
            <Layout></Layout>
          </PrivateRoute> */}
            <Route component={NotFound}></Route>
          </Switch>
        </Suspense>
      </div>
    </Router>
  )
}

export default App
